Skip to content

Conversation

lisajian
Copy link

@lisajian lisajian commented Aug 28, 2025

Description

Adds basic FDC function trigger for onMutationExecuted

Includes unit tests, but missing integration tests, which will be included in a subsequent PR once the backend changes are completed. Also fixes a typo on an existing file

npm test passes locally

Internal tracking bug: b/436623435

Code sample

Examples of how to use this

import { onMutationExecuted } from "firebase-functions/v2/dataconnect";

exports.myfunction = onMutationExecuted(
  {
    service: "service-id",
    connector: "connector-id",
    operation: "mutation-name",
  },
  (event) => { 
    // event.params.service == "service-id" 
    // event.params.connector == "connector-id"
    // event.params.operation == "mutation-name"

    // event.data contains [MutationEventData](https://docs.google.com/document/d/1sCYuBzjhirVTy9Xo2gflGVcKcZyhau9MhkVlbOvC4MI/edit?tab=t.0#bookmark=id.1k7sz3vu87vx)  
  }
);

// Use capture group on operation
exports.myfunctionwithcaptures = onMutationExecuted(
  {
    service: "service-id",
    connector: "connector-id",
    operation: "{operation}",
  },
  (event) => { /** do something */ }
);

// Use wildcard on connector
exports.myfunctionwithwildcards = onMutationExecuted(
  {
    service: "service-id",
    connector: "*",
    operation: "mutation-name",
  },
  (event) => { /** do something */ }
);

See go/fdc-eventarc-functions-sdk for more information

@lisajian lisajian requested a review from taeold August 28, 2025 18:42
@lisajian lisajian marked this pull request as ready for review August 28, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant